home *** CD-ROM | disk | FTP | other *** search
/ Imagine the Universe (9th Edition) / Imagine the Universe 9 - Disc 1.iso / pc / imagine / YBA / M31-velocity / javascript / spectra-quiz.js < prev    next >
Text File  |  2003-01-12  |  590b  |  29 lines

  1. size1 = "Blank";
  2. size2 = "Blank";
  3.  
  4. function testButton(form) {
  5.     for (Count = 0; Count < 5; Count++) {
  6.         if (form.answer1[Count].checked)
  7.     size1 = Count;
  8.     if (form.answer2[Count].checked)
  9.     size2 = Count;
  10.     }
  11.     
  12.     RightAnswer1 = 1;
  13.     RightAnswer2 = 2;
  14.     NumberCorrect = 0;
  15.     AnswerPage = './spectra-quiz-answer.html';
  16.     
  17.     if (size1 == RightAnswer1) {
  18.         NumberCorrect++;
  19.     }
  20.     if (size2 == RightAnswer2) {
  21.         NumberCorrect++;
  22.     }
  23.     
  24.     alert ("You answered " +NumberCorrect + " out of 2 questions correctly!");
  25.     location = AnswerPage; 
  26. }
  27.  
  28.     
  29.